package lyl.license;

import java.io.File;

import com.ucap.system.license.LicenseManager;

import lyl.file.FileUtil;

/**
 * @author Liu Yulong
 */
public class UcapLicenseTest {
    private static LicenseManager lm                   = LicenseManager.getInstance();
    private static final String   LICENSE_PRODUCT_NAME = "Dcas Server 1.0";
    private static final String   LOCALHOST            = "127.0.0.1";

    static {
        lm.setPRODUCT_NAME(LICENSE_PRODUCT_NAME);
        try {
            lm.init(FileUtil.fileToStream(new File("config/license")));
        }
        catch (Exception e) {
            System.out.println("license for " + LICENSE_PRODUCT_NAME
                    + " not exist or is corrupted!");
        }
        try {
            lm.hasRight(LOCALHOST);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {}
}
